import { h } from 'vue';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    type: 'selection',
  }, {
    title: '序号',
    key: 'id',
    align: "center",
  }, {
    title: '二维码编号',
    key: 'charger_qrcode_number',
    align: "center",
    width: '150px'
  }, {
    title: '充电宝编号',
    key: 'charger_number',
    align: "center",
    width: '150px'
  }, {
    title: '名称',
    key: 'charger_name',
    align: "center",
  }, {
    title: '租借次数',
    key: 'usercount',
    align: "center",
  }, {
    title: '协议',
    key: 'type_name',
    align: "center",
    render(row) {
      return h(
        NTag,
        {
          type: 'info',
        },
        {
          default: () => (row.type_name),
        },
      );
    },
  }, {
    title: '门店',
    key: 'charger_station_name',
    align: "center",
  }, {
    title: '代理商',
    key: 'charger_agents_name',
    align: "center",
  }, {
    title: '员工',
    key: 'charger_yuangong_name',
    align: "center",
  }, {
    title: '商户',
    key: 'charger_bussiness_name',
    align: "center",
  }, {
    title: '卡槽数量',
    key: 'charger_battery',
    align: "center",
  }, {
    title: '可借/可还',
    key: 'charger_battery_line',
    align: "center",
    render(row) {
      return h(
        NTag,
        {
          type: 'info',
        },
        {
          default: () => (row.charger_battery_line + '/' + row.charger_battery_lend),
        },
      );
    },
  }, {
    title: '运行状态',
    key: 'charger_runstatus',
    align: "center",
    render(row) {
      if (row.charger_runstatus == 1) {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('在线'),
          },
        );
      } else {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('离线'),
          },
        );
      }

    },
  },
];
